from experiments.ppd_loan.train_config import data_tag, data_hyperparameters, no_adaptation_hyperparameters
from experiments.ppd_loan.train_ppd_fg_adapt_pretrain import create_fg_pdd_global_model
from experiments.ppd_loan.train_ppd_no_fg_adapt_pretrain import create_no_fg_pdd_global_model
from experiments.ppd_loan.train_ppd_utils import train_no_adaptation


def get_model_meta():
    no_da_root_dir = data_hyperparameters["ppd_no-ad_model_dir"]
    apply_feature_group = no_adaptation_hyperparameters['apply_feature_group']
    if apply_feature_group:
        print("[INFO] feature grouping applied")
        model = create_fg_pdd_global_model(num_wide_feature=6)
    else:
        print("[INFO] no feature grouping applied")
        model = create_no_fg_pdd_global_model(aggregation_dim=5, num_wide_feature=6)
    return model, no_da_root_dir


if __name__ == "__main__":
    init_model, ppd_no_ad_model_root_dir = get_model_meta()
    task_id_list = train_no_adaptation(data_tag,
                                       ppd_no_ad_model_root_dir,
                                       no_adaptation_hyperparameters,
                                       data_hyperparameters,
                                       model=init_model)
    print(f"[INFO] task id list:{task_id_list}")
